#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>
#include<vector>
#include<queue>

using namespace std;

vector<int> getFinalState(vector<int>& nums, int k, int multiplier) {
    priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq;
    for (int i = 0; i < nums.size(); i++)  pq.emplace(nums[i], i);

    while (k--)
    {
        auto t = pq.top();
        pq.pop();
        nums[t.second] *= multiplier;
        pq.emplace(nums[t.second], t.second);
    }

    return nums;
}